package com.juzipi.demo.service;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.juzipi.demo.mapper.RoleMapper;
import com.juzipi.demo.pojo.Role;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoleService {


    @Autowired
    private RoleMapper roleMapper;


    public List<Role> queryRoleList(List<Long> roleIds){
//        QueryWrapper<Role> wrapper = new QueryWrapper<>();
//        wrapper.in("id",roleIds);
//        return roleMapper.selectList(wrapper);
        //学会了
        return roleMapper.selectList(new QueryWrapper<Role>().lambda().in(Role::getId, roleIds));

    }


    public void createRole(Role role) {
        roleMapper.insert(role);
    }


}
